package cn.wolfcode.utils;

import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import java.util.Collections;
import java.util.List;

@Data
public class PageResult {

    //数据集
    private List data;
    //数据总条数
    private int totalCount;
    //总页数
    private int totalPage;
    //上一页
    private int prevPage;
    //下一页
    private int nextPage;
    //当前页
    private int currentPage;
    //每页显示条数
    private int pageSize;


    /*//缺参构造器
    public PageResult(List data, int totalCount, int currentPage, int pageSize) {
        this.data = data;
        this.totalCount = totalCount;
        this.currentPage = currentPage;
        this.pageSize = pageSize;

        this.totalPage = totalCount % pageSize == 0 ? totalCount / pageSize : totalCount / pageSize + 1;
        this.prevPage = currentPage - 1 > 1 ? currentPage - 1 : 1;
        this.nextPage = currentPage + 1 < totalPage ? currentPage + 1 : totalPage;
    }

    public PageResult(int currentPage, int pageSize){
        this.data = Collections.emptyList();
        this.totalCount = 0;
        this.currentPage = currentPage;
        this.pageSize = pageSize;
    }*/
}
